/*
 * chat.h
 *
 *  Created on: 2012. 4. 30.
 *      Author: jphong
 */

#ifndef CHAT_H_
#define CHAT_H_

#define	MAXID		128
#define UNKNOWN		99

// Local User Command token number

#define U_FROM		16
#define U_USER		17
#define U_WHO		18
#define U_QUIT		19
#define	U_TALK		20
#define U_DEBUG		21
#define U_HELP		22
#define	U_EOT		23
#define	U_DELAY		24
//
#define	U_SEND		25
#define	U_ACCEPT	26
#define	U_REJECT	27
//////////////////////

// Request Message token number
#define T_FROM		32
#define T_USER		33
#define T_WHO		34
#define T_QUIT		35
//
#define T_SEND		36
#define T_ACCEPT	37
#define T_REJECT	38
//////////////////////

// User Command and Protocol Message Definition
typedef struct {
	int token;
	char *str;
	char *fmt;
} Cmd;

// Request Methods and syntax
static Cmd method[] = {
		{ T_FROM, "FROM", "FROM %s TO %s\r\n%s\r\n\r\n" },
		{ T_USER, "USER", "USER %s\r\n\r\n" },
		{ T_WHO, "WHO", "WHO\r\n\r\n" },
		{ T_QUIT, "QUIT", "QUIT\r\n\r\n" },
		//
		{T_SEND, "SEND", "SEND %s FROM %s TO %s\r\n\r\n"},
		{T_ACCEPT, "ACCEPT", "ACCEPT %s FROM %s TO %s\r\n\r\n"},
		{T_REJECT, "REJECT", "REJECT %s FROM %s TO %s\r\n\r\n"},
		/////////////////////////
		{ 0, "", "" } };

#endif /* CHAT_H_ */
